

<h3 class='lead'>Petition List</h3>
<hr>
<br>
<div id='table-container' > 
     <table id='table-list' class=''>            
        <thead><tr>
                <th>PetitionTitle</th>
                <th>Category </th>
                <th>Votes </th>
                </tr>
            </thead>
            <tbody>
            <?php foreach ($list as $petition): ?>
                <tr class = 'tr_petition' data-petition-id="<?= $petition->id?>">
                    <td > <?= $petition->title; ?></td>
                    <td> <?=$petition->category->name; ?></td>
                    <td> <?=$petition->votes; ?></td>
                </tr>
            <?php endforeach; ?>
           </tbody>
           <tfoot>
           	      <td colspan="3">  <?= $this->pagination->create_links(); ?> </td>
           </tfoot>
    </table>
</div>

<script>
jQuery('tbody tr').click(function(){
	var petition_link = jQuery(this).attr('data-petition-id');	
	console.log(<?= json_encode(base_url()) ?> + 'petitions/view/' + petition_link);
	window.location.replace(<?= json_encode(base_url()) ?> + 'petitions/view/' + petition_link);
})
</script>